<?php
//1 修改入口 链接
//2 ariicle_modify.php? => article_detail.php
//3 提交 article_modify_do.php?
//  update article set Title=$title where Id=$id
//  title=$_POST,content,updateTime = now,id=$_GET

//4 跳回到 article_list.php   //Header("Location: article_list.php"); 
//https://www.php.cn/php-weizijiaocheng-395641.html

session_start();
$currentUser = $_SESSION["user"];
$id = $_GET["Id"];
$sql = "SELECT * FROM `article` WHERE Id=$id";
$conn = new mysqli("localhost","root","","myblog");

$rs = $conn->query($sql);
if($conn->error) die($conn->error);
$detail = $rs->fetch_assoc();



?>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />  
    <title>第一个网页</title>
</head>
<body>
    <form mothod="post" action="article_modify_do.php?id=<?=$id ?>">
    <div>
        <label>标题</label> 
        <input type="text" name="Title" value="<?=$detail["Title"]?>">
    </div>
    <div>
        <label>内容</label> 
        <textarea name="Content"><?=$detail["Content"]?></textarea>
    </div>
   
    <div>
        <?=$detail["AuthorName"]?>编辑于
        <?=$detail["UpdateTime"]?>
    </div>
    <div>
        <input type="submit" value="提交">
        <a href="article_list.php">返回列表</a>
    </div>
   
    </form>
</body>
</html>